﻿Imports System
Imports System.IO
Imports System.Data.OleDb
Imports System.Data

Imports System.Net.Mail


Namespace Arwani
    Partial Class index
        Inherits System.Web.UI.Page
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        End Sub

       
        Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
            Dim awrcon As New ArwaniController
            Dim str As String = "select * from CUSTOMERMASTER where CUSTCODE ='" & txtCustomerCode.Text & "' and password='" & txtPassword.Text & "'"
            Dim dtTable As DataTable = awrcon.ExecuteQuery(str)
            If dtTable.Rows.Count > 0 Then
                Response.Cookies("Code").Value = dtTable.Rows(0)("CUSTCODE").ToString()
                Response.Cookies("Name").Value = dtTable.Rows(0)("CUSTNAME").ToString()
                Response.Cookies("Code").Expires = DateTime.Now.AddDays(1)
                Response.Cookies("Name").Expires = DateTime.Now.AddDays(1)
                Response.Redirect("CustomerInvoice.aspx")
            Else
                lblErrorMsg.Text = "Login Failed"

            End If
        End Sub
    End Class
End Namespace